/**
 * Copyright (c) 2017-2024 Nop Platform. All rights reserved.
 * Author: canonical_entropy@163.com
 * Blog:   https://www.zhihu.com/people/canonical-entropy
 * Gitee:  https://gitee.com/canonical-entropy/nop-entropy
 * Github: https://github.com/entropy-cloud/nop-entropy
 */
package com.gitee.wsl.struct.table.impl

import com.gitee.wsl.struct.table.CellRange
import com.gitee.wsl.struct.table.ICellView
import com.gitee.wsl.struct.table.IRowView
import com.gitee.wsl.struct.table.ITableView


class SubRowView(override val table: ITableView,
                  val row: IRowView,
                  val range: CellRange) : IRowView by row{

    override val colCount: Int
        get() = range.colCount

    override val isEmpty: Boolean
        get() = false

    private fun mapCol(colIndex: Int): Int {
        return range.firstColIndex + colIndex
    }

    override fun getCell(colIndex: Int): ICellView {
        return row.getCell(mapCol(colIndex))!!
    }

    override val cells: List<ICellView?>
        get() = row.cells.subList(range.firstColIndex, range.lastColIndex + 1)

    /*fun prop_get(propName: String?): Any {
        return row.prop_get(propName)
    }

    fun prop_has(propName: String?): Boolean {
        return row.prop_has(propName)
    }

    fun prop_set(propName: String?, value: Any?) {
        row.prop_set(propName, value)
    }*/
}